import { Space, Button } from "antd"
import { useComponentStore } from "../../editor/stores/components"

export function Header() {
    const { mode, setMode, setCurComponentId } = useComponentStore()


    return (
        <div className="w-full h-full">
            <div className="h-[50px] flex justify-between items-center px-[20px]">
                <div>低代码编辑器</div>
                <Space>
                    {mode === 'edit' && (
                        <Button
                            type="primary"
                            onClick={() => {
                                setMode('preview')
                                setCurComponentId(null)
                            }}
                        >
                            预览
                        </Button>
                    )}
                    {mode === 'preview' && (
                        <Button
                            type="primary"
                            onClick={() => {
                                setMode('edit')
                                setCurComponentId(null)
                            }}
                        >
                            退出预览
                        </Button>
                    )}
                </Space>
            </div>
        </div>
    )
}